package com.lestco;

import com.crungoo.minio.MinIoFileRemoteService;
import com.crungoo.sdk.mqttplus.MQTTX;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author fujc2dev@126.com
 * @date 2024-08-28
 */
@RestController
@RequestMapping("/minio/file")
public class MyController {

    @Resource
    private MinIoFileRemoteService minIoFileRemoteService;

    @PostMapping("upload")
    public Object upload(@RequestParam("file") MultipartFile multipartFile) {
        return minIoFileRemoteService.upload(multipartFile);
    }

    @PostMapping("send")
    public String upload() {
        MQTTX.push("zxxx", "xxx");
        return "";
    }
}
